fix(jest-changed-files): only return files from getChangedFilesFromRoots
#7961
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #7956.
Previously,
getChangedFilesFromRoots
would return parts of commit messages as if they were files, if the commit message contained multiple paragraphs of text.Test plan
I've updated the e2e tests in
jestChangedFiles.test.js
to include a commit message that includes multiple paragraphs (for bothhg
andgit
).I decided on augmenting existing tests instead of making new ones to prevent an increase in running time.
In the case of
hg
, one of the files in the repository has had its contents changed to be on multiple lines, and one of the commits to be made withhg commit -l filename
It could have been done with
sh -c echo "line1\\nline2" | hg commit -l -"
, but that would have required a change of functionality inUtils.js#run
, which I didn't feel like. 😄For
git
, the multiline commit message is made with multiple-m
parameters, which puts the different messages in separate paragraphs.